package com.gack.helper.common;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import lombok.extern.slf4j.Slf4j;


@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

	@ExceptionHandler(value = Exception.class)
	public Object defaultErrorHandler(HttpServletRequest request, Exception e) throws Exception {
		
		log.error("-------------------------ERROR-------------------------");
		log.error("URL : " + request.getRequestURL().toString());
		log.error("EXCEPTION : " + e.toString());
	
		return new AjaxJson().setSuccess(false).setStatus(500).setMsg("操作失败").setData(null);
	}

}
